﻿namespace BooDoo

import System
import System.Globalization
import System.Resources.ResourceManager as RM

[Boo.Lang.Useful.Attributes.Singleton]
final class ResourceManager:
"""Description of ResourceManager"""
	
	[getter(StringsResourceId)]
	private final stringsResourceId = "BooDoo.resources"
	
	private _rm = RM(StringsResourceId, typeof(ResourceManager).Assembly)
	
	def GetString([required] name as string):
		try:
			return _rm.GetString(name);	
		except:
			return "Resource not found: " + name
		
	def Format([required] name as string, *args as (object)):
		return string.Format(CultureInfo.CurrentUICulture, GetString(name), *args)
